# -*- coding: utf-8 -*-

from django.contrib import admin
from nstat.traffic.models import TrafficCategory, Tariff, TariffRule, \
    UserProfile, PrepaidPacket, Payment, PaymentCategory, TrafficUnit, \
    BadLine, InternetChannel
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin

#admin.site.unregister(Group)

admin.site.register(TrafficCategory)

class TariffRuleInline(admin.TabularInline):
    model = TariffRule
    extra = 1

class TariffAdmin(admin.ModelAdmin):
    inlines = (TariffRuleInline,)
    fieldsets = (
        (None, {
            'fields': ('name', ('cost', 'period'), 'is_public')
        }), )

admin.site.register(Tariff, TariffAdmin)


class UserProfileInline(admin.StackedInline):
    model = UserProfile

class MyUserAdmin(UserAdmin):
    inlines = (UserProfileInline, )

admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)

admin.site.register(Payment)
admin.site.register(PaymentCategory)
admin.site.register(PrepaidPacket)
admin.site.register(TrafficUnit)
admin.site.register(BadLine)
admin.site.register(InternetChannel)
